package cn.sdhuijin.healthexam.activity;

import java.io.File;

import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;
import android.view.View;
import android.view.View.OnClickListener;
import cn.sdhuijin.healthexam.ExitApplication;
import cn.sdhuijin.healthexam.R;
import cn.sdhuijin.healthexam.control.AbstractControlActivity;

/**
 * 中医体质判定详细信息
 * 
 * @author houyuchun
 * 
 */
public class BodyJudgeInfoActivity extends AbstractControlActivity implements
		OnClickListener {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_body_judge_info);
		ExitApplication.getInstance().addActivity(this);

		Intent intent = getIntent();
		// 获取传递过来的sql语句
		String fileName = intent.getStringExtra("filename");
		initTextView();
		setTextViewValue(fileName);
		setButtonListener(this, R.id.btn_back);

	}

	@Override
	public void onClick(View v) {
		int clickId = (Integer) v.getId();
		switch (clickId) {
		case R.id.btn_back:
			finish();
			break;
		default:
			break;
		}
	}

	/**
	 * TextView初始化赋值
	 */
	private void initTextView() {

		addTextView(R.id.txt_user_name, "姓名");
		addTextView(R.id.txt_identifyNum, "身份证号");
		addTextView(R.id.txt_visit_doctor, "随访医师");
		addTextView(R.id.txt_visit_date, "随访日期");

		// addTextView(R.id.txt_yinxuzhi_001, "阴虚质发热");
		// addTextView(R.id.txt_yinxuzhi_002, "阴虚质脸上发热");
		// addTextView(R.id.txt_yinxuzhi_003, "阴虚质唇干");
		// addTextView(R.id.txt_yinxuzhi_004, "阴虚质口唇");
		// addTextView(R.id.txt_yinxuzhi_005, "阴虚质便秘");
		// addTextView(R.id.txt_yinxuzhi_006, "阴虚质面部偏红");
		// addTextView(R.id.txt_yinxuzhi_007, "阴虚质眼睛干涩");
		// addTextView(R.id.txt_yinxuzhi_008, "阴虚质口干");
		//
		// addTextView(R.id.txt_yangxuzhi_001, "阳虚质发凉");
		// addTextView(R.id.txt_yangxuzhi_002, "阳虚质怕冷");
		// addTextView(R.id.txt_yangxuzhi_003, "阳虚质怕冷");
		// addTextView(R.id.txt_yangxuzhi_004, "阳虚质寒冷");
		// addTextView(R.id.txt_yangxuzhi_005, "阳虚质感冒");
		// addTextView(R.id.txt_yangxuzhi_006, "阳虚质吃凉");
		// addTextView(R.id.txt_yangxuzhi_007, "阳虚质腹泻");
		//
		// addTextView(R.id.txt_qixuzhi_001, "气虚质疲乏");
		// addTextView(R.id.txt_qixuzhi_002, "气虚质气短");
		// addTextView(R.id.txt_qixuzhi_003, "气虚质心慌");
		// addTextView(R.id.txt_qixuzhi_004, "气虚质头晕");
		// addTextView(R.id.txt_qixuzhi_005, "气虚质感冒");
		// addTextView(R.id.txt_qixuzhi_006, "气虚质安静");
		// addTextView(R.id.txt_qixuzhi_007, "气虚质说话");
		// addTextView(R.id.txt_qixuzhi_008, "气虚质虚汗");
		//
		// addTextView(R.id.txt_danshizhi_001, "痰湿质胸闷");
		// addTextView(R.id.txt_danshizhi_002, "痰湿质沉重");
		// addTextView(R.id.txt_danshizhi_003, "痰湿质松软");
		// addTextView(R.id.txt_danshizhi_004, "痰湿质油脂");
		// addTextView(R.id.txt_danshizhi_005, "痰湿质眼睑");
		// addTextView(R.id.txt_danshizhi_006, "痰湿质嘴里");
		// addTextView(R.id.txt_danshizhi_007, "痰湿质痰多");
		// addTextView(R.id.txt_danshizhi_008, "痰湿质虚汗");
		//
		// addTextView(R.id.txt_shirezhi_001, "湿热质油腻");
		// addTextView(R.id.txt_shirezhi_002, "湿热质痤疮");
		// addTextView(R.id.txt_shirezhi_003, "湿热质口苦");
		// addTextView(R.id.txt_shirezhi_004, "湿热质黏滞");
		// addTextView(R.id.txt_shirezhi_005, "湿热质发热");
		// addTextView(R.id.txt_shirezhi_006, "湿热质色黄");
		// addTextView(R.id.txt_shirezhi_007, "湿热质潮湿");
		//
		// addTextView(R.id.txt_xueyuzhi_001, "血瘀质瘀斑");
		// addTextView(R.id.txt_xueyuzhi_002, "血瘀质微红");
		// addTextView(R.id.txt_xueyuzhi_003, "血瘀质疼痛");
		// addTextView(R.id.txt_xueyuzhi_004, "血瘀质褐斑");
		// addTextView(R.id.txt_xueyuzhi_005, "血瘀质黑眼圈");
		// addTextView(R.id.txt_xueyuzhi_006, "血瘀质健忘");
		// addTextView(R.id.txt_xueyuzhi_007, "血瘀质偏黯");
		//
		// addTextView(R.id.txt_qiyuzhi_001, "气郁质低沉");
		// addTextView(R.id.txt_qiyuzhi_002, "气郁质不安");
		// addTextView(R.id.txt_qiyuzhi_003, "气郁质多愁");
		// addTextView(R.id.txt_qiyuzhi_004, "气郁质害怕");
		// addTextView(R.id.txt_qiyuzhi_005, "气郁质胀痛");
		// addTextView(R.id.txt_qiyuzhi_006, "气郁质叹气");
		// addTextView(R.id.txt_qiyuzhi_007, "气郁质异物");
		//
		// addTextView(R.id.txt_tebingzhi_001, "特禀质喷嚏");
		// addTextView(R.id.txt_tebingzhi_002, "特禀质鼻塞");
		// addTextView(R.id.txt_tebingzhi_003, "特禀质咳喘");
		// addTextView(R.id.txt_tebingzhi_004, "特禀质过敏");
		// addTextView(R.id.txt_tebingzhi_005, "特禀质荨麻疹");
		// addTextView(R.id.txt_tebingzhi_006, "特禀质紫癜");
		// addTextView(R.id.txt_tebingzhi_007, "特禀质抓痕");
		//
		// addTextView(R.id.txt_pinghezhi_001, "平和质充沛");
		// addTextView(R.id.txt_pinghezhi_002, "平和质疲乏");
		// addTextView(R.id.txt_pinghezhi_003, "平和质无力");
		// addTextView(R.id.txt_pinghezhi_004, "平和质低沉");
		// addTextView(R.id.txt_pinghezhi_005, "平和质寒冷");
		// addTextView(R.id.txt_pinghezhi_006, "平和质变化");
		// addTextView(R.id.txt_pinghezhi_007, "平和质失眠");
		// addTextView(R.id.txt_pinghezhi_008, "平和质健忘");

		addTextView(R.id.txt_question_001, "question01");
		addTextView(R.id.txt_question_002, "question02");
		addTextView(R.id.txt_question_003, "question03");
		addTextView(R.id.txt_question_004, "question04");
		addTextView(R.id.txt_question_005, "question05");
		addTextView(R.id.txt_question_006, "question06");
		addTextView(R.id.txt_question_007, "question07");
		addTextView(R.id.txt_question_008, "question08");
		addTextView(R.id.txt_question_009, "question09");
		addTextView(R.id.txt_question_010, "question10");
		addTextView(R.id.txt_question_011, "question11");
		addTextView(R.id.txt_question_012, "question12");
		addTextView(R.id.txt_question_013, "question13");
		addTextView(R.id.txt_question_014, "question14");
		addTextView(R.id.txt_question_015, "question15");
		addTextView(R.id.txt_question_016, "question16");
		addTextView(R.id.txt_question_017, "question17");
		addTextView(R.id.txt_question_018, "question18");
		addTextView(R.id.txt_question_019, "question19");
		addTextView(R.id.txt_question_020, "question20");
		addTextView(R.id.txt_question_021, "question21");
		addTextView(R.id.txt_question_022, "question22");
		addTextView(R.id.txt_question_023, "question23");
		addTextView(R.id.txt_question_024, "question24");
		addTextView(R.id.txt_question_025, "question25");
		addTextView(R.id.txt_question_026, "question26");
		addTextView(R.id.txt_question_027, "question27");
		addTextView(R.id.txt_question_028, "question28");
		addTextView(R.id.txt_question_029, "question29");
		addTextView(R.id.txt_question_030, "question30");
		addTextView(R.id.txt_question_031, "question31");
		addTextView(R.id.txt_question_032, "question32");
		addTextView(R.id.txt_question_033, "question33");

		addTextView(R.id.txt_body_type, "体质类型");
		addTextView(R.id.txt_body_feature, "体质特征");
		addTextView(R.id.txt_advice, "调节建议");
	}

	/**
	 * 读取对应文件，设置各个控件值
	 * 
	 * @param fileName
	 *            文件名称
	 */
	private void setTextViewValue(String fileName) {
		try {
			File f = new File(Environment.getExternalStorageDirectory()
					.getPath() + "/health/" + fileName + ".txt");
			if (f.exists()) {
				controlManager.setPropertiesPath(f.getAbsolutePath());
				controlManager.toControl();
			} else {
				toastInformation(R.string.record_deleted);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
